<?php

namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;

class LoginRequest extends FormRequest
{
	/**
	 * Determine if the user is authorized to make this request.
	 * @return bool
	 */
	public function authorize() {
		return true;
	}

	/**
	 * Get the validation rules that apply to the request.
	 * @return array
	 */
	public function rules() {
		return [
			'username' => 'required|between:5,12',
			'password' => 'required|between:6,16',
			'code' => 'required|captcha'
		];
	}

	public function messages() {
		return [
			'code.required' => '验证码不能为空',
			'code.captcha' => '验证码不正确'
		];
	}
}
